package com.xxb.system.user.rest;

import com.xxb.common.result.R;
import com.xxb.system.feign.dto.user.QueryUserReqFeignDTO;
import com.xxb.system.feign.dto.user.QueryUserRespFeignDTO;
import com.xxb.system.feign.service.user.UserServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author RenGaoshuai
 * @date 2023/7/27 16:44
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserServiceFeign userServiceFeign;

    @PostMapping("/query/query")
    public R<QueryUserRespFeignDTO> queryUser(){
        QueryUserReqFeignDTO queryUserReqFeignDTO = new QueryUserReqFeignDTO();
        queryUserReqFeignDTO.setId("123");
        R<QueryUserRespFeignDTO> result = userServiceFeign.queryUserInfo(queryUserReqFeignDTO);
        if (result.isFail()){
            return R.ofFail(result.getMessage());
        }

        return R.ofSuccess(result.getData());
    }
}
